/*
 * 
 * 
 * 
 */
package com.hboxs.asl.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.*;

/**
 * Entity - 三级分销记录
 */
@Entity
@Table(name = "xx_point_trade")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_point_trade_sequence")
public class PointTrade extends BaseEntity {

    private static final long serialVersionUID = -6209590619136922215L;


    /**
     * 流水号
     */
    private String tn;

    /**
     * 消费金额
     */
    private BigDecimal amount;

    /**
     * 消费的积分
     */
    private BigDecimal point;

    /**
     * 利润比例
     */
    private BigDecimal proportion;

    /**
     * 用户
     */
    private Member member;

    /**
     * 用户推荐人
     */
    private Member memberParent;

    /**
     * 用户推荐人的推荐商家
     */
    private Merchant memberParentMerchant;

    /**
     * 用户推荐人的推荐人
     */
    private Member memberParentMember;

    /**
     * 用户推荐商家
     */
    private Merchant toMerchant;

    /**
     * 用户获得的积分
     */
    private BigDecimal mPoint;

    /**
     * 用户推荐主播收到的余额
     */
    private BigDecimal mParentAmount;

    /**
     * 用户推荐商家收到的余额
     */
    private BigDecimal merchantAmount;

    /**
     * 用户推荐主播的商家收到的余额
     */
    private BigDecimal mParentMerchantAmount;

    /**
     * 用户推荐主播的推荐主播收到的余额
     */
    private BigDecimal mParentMemberAmount;

    /**
     * 平台收到的余额
     */
    private BigDecimal platformBalance;

    /**
     * 主播佣金订单列表
     */
    private List<AnchorTrade> anchorTrades = new ArrayList<>();

    @OneToMany(mappedBy = "pointTrade", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public List<AnchorTrade> getAnchorTrades() {
        return anchorTrades;
    }

    public void setAnchorTrades(List<AnchorTrade> anchorTrades) {
        this.anchorTrades = anchorTrades;
    }

    public PointTrade(){
        super();
    }

    public PointTrade(String tn, BigDecimal point , BigDecimal amount, BigDecimal proportion , Member member, Member memberParent, Merchant memberParentMerchant,
                      Member memberParentMember , Merchant toMerchant, BigDecimal mPoint,
                      BigDecimal mParentAmount, BigDecimal merchantAmount, BigDecimal mParentMerchantAmount, BigDecimal mParentMemberAmount,
                      BigDecimal platformBalance) {
        this.tn = tn;
        this.point = point;
        this.amount = amount;
        this.proportion = proportion;
        this.member = member;
        this.memberParent = memberParent;
        this.memberParentMerchant = memberParentMerchant;
        this.memberParentMember = memberParentMember;
        this.toMerchant = toMerchant;
        this.mPoint = mPoint;
        this.mParentAmount = mParentAmount;
        this.merchantAmount = merchantAmount;
        this.mParentMerchantAmount = mParentMerchantAmount;
        this.mParentMemberAmount = mParentMemberAmount;
        this.platformBalance = platformBalance;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * 获取流水号
     *
     * @return 流水号
     */
    public String getTn() {
        return tn;
    }

    /**
     * 设置流水号
     *
     * @param tn 流水号
     */
    public void setTn(String tn) {
        this.tn = tn;
    }

    /**
     * 获取会员
     *
     * @return 会员
     */
    @ManyToOne(fetch = FetchType.LAZY)
    public Member getMember() {
        return member;
    }

    /**
     * 设置会员
     *
     * @param member 会员
     */
    public void setMember(Member member) {
        this.member = member;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Member getMemberParent() {
        return memberParent;
    }

    public void setMemberParent(Member memberParent) {
        this.memberParent = memberParent;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Merchant getToMerchant() {
        return toMerchant;
    }

    public void setToMerchant(Merchant toMerchant) {
        this.toMerchant = toMerchant;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Merchant getMemberParentMerchant() {
        return memberParentMerchant;
    }

    public void setMemberParentMerchant(Merchant memberParentMerchant) {
        this.memberParentMerchant = memberParentMerchant;
    }

    public BigDecimal getmPoint() {
        return mPoint;
    }

    public void setmPoint(BigDecimal mPoint) {
        this.mPoint = mPoint;
    }

    public BigDecimal getPlatformBalance() {
        return platformBalance;
    }

    public void setPlatformBalance(BigDecimal platformBalance) {
        this.platformBalance = platformBalance;
    }

    public BigDecimal getmParentAmount() {
        return mParentAmount;
    }

    public void setmParentAmount(BigDecimal mParentAmount) {
        this.mParentAmount = mParentAmount;
    }

    public BigDecimal getMerchantAmount() {
        return merchantAmount;
    }

    public void setMerchantAmount(BigDecimal merchantAmount) {
        this.merchantAmount = merchantAmount;
    }

    public BigDecimal getmParentMerchantAmount() {
        return mParentMerchantAmount;
    }

    public void setmParentMerchantAmount(BigDecimal mParentMerchantAmount) {
        this.mParentMerchantAmount = mParentMerchantAmount;
    }

    public BigDecimal getmParentMemberAmount() {
        return mParentMemberAmount;
    }

    public void setmParentMemberAmount(BigDecimal mParentMemberAmount) {
        this.mParentMemberAmount = mParentMemberAmount;
    }

    public BigDecimal getPoint() {
        return point;
    }

    public void setPoint(BigDecimal point) {
        this.point = point;
    }

    public BigDecimal getProportion() {
        return proportion;
    }

    public void setProportion(BigDecimal proportion) {
        this.proportion = proportion;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Member getMemberParentMember() {
        return memberParentMember;
    }

    public void setMemberParentMember(Member memberParentMember) {
        this.memberParentMember = memberParentMember;
    }
}